import time
import threading


class Account:
    def __init__(self, balance: int):
        self.balance = balance

    def withdraw_money(self, amount: int):
        if self.balance >= amount:
            time.sleep(0.1)
            self.balance = self.balance - amount
            print('%s取钱成功，余额：%s' % (threading.current_thread().name, self.balance))
        else:
            print('%s取钱失败，余额为：' % (threading.current_thread().name, self.balance))

if __name__ == '__main__':
    account = Account(balance=1000)
    Lilith = threading.Thread(target=account.withdraw_money, args=(800,), name='Lilith')
    Krul = threading.Thread(target=account.withdraw_money, args=(800,), name='Krul')

    Lilith.start()
    Krul.start()

